@extends('shop::layouts.master')
@section('title')
    单个退款
@endsection
@section('tab')
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form" lay-filter="form_refund">
                <div class="layui-form-item">
                    <label for="L_remarks" class="layui-form-label">
                        <span class="x-red">*</span>备注</label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_remarks" name="remarks" required="" lay-verify="remarks" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label"></label>
                    <button class="layui-btn layui-btn-danger " lay-filter="edit" lay-submit="">检测失败-故障</button>
                    <input type="hidden" id="L_id" name="id">
                </div>
            </form>
        </div>
    </div>
@endsection

@section('tab_css')
@endsection
@section('tab_js')
    <script>


        layui.use(['form', 'layer','layedit','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                    layer = layui.layer,
                    layedit = layui.layedit;

                //创建一个编辑器
                var editIndex = layedit.build('LAY_demo_editor');

                //自定义验证规则
                form.verify({
                    remarks: function(value) {
                        if (value.length <= 0) {
                            return '不能为空';
                        }
                        layedit.sync(editIndex);

                    },
                });

                //监听提交
                form.on('submit(edit)',
                    function(data) {
                        var $_url = '{{route('shop_order_checkpoint_fail_single')}}';
                        var $_data = data.field;
                        $.ajax({
                            url:$_url,
                            type:'post',
                            data:$_data,
                            dataType : "json",
                            success:function(result){
                                if(result.state === 0){
                                    layer.msg(
                                        "操作成功",
                                        {icon: 6},
                                        function() {
                                            //关闭当前frame
                                            xadmin.close();

                                            // 可以对父窗口进行刷新
                                            xadmin.father_reload();
                                        });
                                }else{
                                    layer.msg(result.msg, {time:2000,icon: 5});
                                }

                            }});
                        return false;

                    });

                //表单初始赋值
                form.val('form_refund', {
                    "id": '{{$n_id}}',
                })

            });
    </script>
@endsection




